<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_reply', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('微信公众号-自定义回复表');

            $table->increments('id');
            $table->char('name', 32)->comment('回复标识')->default('');
            $table->char('appid', 32)->comment('微信公众号的appid')->default('');
            $table->tinyInteger('receive_type')->comment('接收消息类型：1，普通消息，2，事件推送')->unsigned()->default(1);
            $table->char('receive_msg_type', 32)->comment('接收普通消息类型')->default('text');
            $table->string('receive_content', 512)->comment('接受内容')->default('');
            $table->char('event', 32)->comment('接收事件推送类型')->default('');
            $table->char('event_key', 32)->comment('接收事件KEY值')->default('');
            $table->char('reply_msg_type', 32)->comment('回复消息类型')->default('text');
            $table->string('reply_content', 1000)->comment('回复内容')->default('');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->string('creater', 32)->comment('创建人')->default('');

            $table->index('appid');
            $table->index('receive_type');
            $table->index('event');
            $table->index('event_key');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_reply');
    }
};
